<?php
class ServiceController extends Zend_Controller_Action
{	
    
    public function indexAction()
    {
        $this->view->title = "Dịch vụ";
        $modelAbout = new Vina_Model_Abouts();
        $dataService = $modelAbout->fetchListToArray("type = 'service'", 'id desc', 3);
        $paginator         = Zend_Paginator::factory($dataService);
            $currentPage       = 1;
            //Check if the user is not on page 1
            $page              = $this->_getParam('page');
            if (! empty($page)) { //Where page is the current page
                $currentPage   = $this->_getParam('page');
            }
            //Set the properties for the pagination
            $paginator->setItemCountPerPage(30);
            $paginator->setPageRange(6);
            $paginator->setCurrentPageNumber($currentPage);
            Zend_Paginator::setDefaultScrollingStyle('Sliding');
            Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
            $paginator->setView($this->view);
           
            $this->view->data = $paginator;
    }
    public function detailAction() {
        
        $model                    = new Vina_Model_Abouts();
        $id                     =  $this->_request->getParam('id',0);
        $data = $model->find($id)->toArray();
        
        $this->view->title = $data['title'];
        $otherData = $model->fetchListToArray("id != $id and type = 'service'",'id desc', 10);
        $this->view->data = $data;
        $this->view->otherData = $otherData;
    }
    	
}
